<?php
require_once ROOT_APPLICATION_MODULES_ADMIN_MODELS.DS."Users.php";
class Zend_View_Helper_ShowActivePage {
    public function showActivePage($view) {
		$modelUser = new End_Models_Users();
    	$page = $view->Pages;
    	$str='';
        $str .= '<table border="1">';
        $str .= '<tr>';
        $str .= '<th width="30%" ><a href="">Tên trang</a></th>';    
        $str .= '<th width="30%"><a href="">Mô tả</a></th>';
        $str .= '<th width="30%"><a href="">Người tạo</a></th>';
       
        $str .= '</tr>';

        $i=0;
        $user_name='';
        foreach ($page as $page) {
        	
        	if($page->is_active==1)
        	{
        		if($page->user_id == 0||$page->user_id == null)
        			$user_name='';
        		else 
        			$user_name=$modelUser->_getUserName($page->user_id);
            	if($i>=1)
                	$i=0;
            	else
                	$i++;
            
            	if($i==1)
                	$str .= '<tr>';
            	else 
                	$str .= '<tr >';
                
            	$str .='<td align="center"><a title="Xem"  href="'.$view->url(array('controller'=>'page', 'action'=>'detail', 'page_id'=>$page->page_id)).'">'.$page->name.'</a></td>';
            	$str .='<td align="center">'.$page->description.'</td>';
            	$str .='<td align="center">'.$user_name.'</td>';
                $str .='</tr>';
        	}
        }
        $str .= '</table>';
        
        return $str; 

    }
}